home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 012 / foreach.arc / FOREACH.TXT < prev    next >
Encoding:
Text File  |  1986-10-03  |  1.7 KB  |  51 lines

  1.                                                 FOREACH.EXE
  2.  
  3.                                                 Class: UNIX
  4.  
  5. Repeat keyboard commands for a series of files or options.
  6.  
  7. NAME
  8.     FOREACH                     Repeat commands
  9.  
  10. SYNOPSIS
  11.     foreach [-v] <variable> list | @file
  12.  
  13. DESCRIPTION
  14.     Foreach will repeat a series of commands substituting the current
  15.     value of the variable during each pass. The variable is accessed by
  16.     placing a '$' in front of the choosen letter. For example, if the
  17.     variable if f than $f would be used in the command line.
  18.  
  19. OPTIONS
  20.     The below list are modifiers for use with the replacement
  21.     variable:
  22.         :e  replaces with extension     (d:\path\file.ext -> ext)
  23.         :h  replaces with head of path  (d:\path\file.ext -> d:\path)
  24.         :n  replaces with name of file  (d:\path\file.ext -> file)
  25.         :r  replaces with root of file  (d:\path\file.ext -> d:\path\file)
  26.         :t  replaces with tail of file  (d:\path\file.ext -> file.ext)
  27.  
  28.     The use of the -v option prior to declaring the variable will enable
  29.     the verbose mode. In this mode each command will be displayed on the
  30.     screen prior to execution.
  31.  
  32. EXAMPLES
  33.     foreach -v f *.c
  34.     del $f:n.obj
  35.     del $f:n.exe
  36.     end
  37.  
  38.     In the above example all files that are present as .C files will
  39.     have thier associated .OBJ and .EXE files deleted. The series of
  40.     commands is terminated by the word end or END.
  41.  
  42.     foreach r @files
  43.     copy $f \batch
  44.     del $f
  45.     end
  46.  
  47.     In this case the files to be operated upon are in the file 'files'.
  48.     The preface of '@' on the foreach command line instructs the program
  49.     to obtain the files list from a file.
  50.     
  51.